<form class="layui-form" action="" lay-filter="copyToUserConditionForm" xmlns="http://www.w3.org/1999/html">
<div style="padding: 10px 20px; height: 100%;">
    <table class="layui-table">
        <tr>
            <td>全局提醒消息方式:</td>
            <td>
                <!--通知方式-->
                <div class="layui-input-inline">
                    <#list handlersMap?keys as key>
                    <input type="checkbox" class="layui-input" lay-filter="informType" name="inner" lay-skin="primary" checked value="${key}" title="${handlersMap[key].title }"  />
                    <!--<span style="line-height: 44px;">-->
                            <!--${handlersMap[key].title }-->
                        <!--</span>-->
                </#list>
               </div>
            </td>
        </tr>
    <tr>
        <table id="otherParamCopierTable"lay-filter="otherParamCopierTable"></table>
    </tr>
    </table>
</div>
   <div hidden><input type="hidden" name="conditionId"></div>
</form>

<!--<div class="layui-btn-container" style="text-align: center;position: absolute;bottom: 15px;left: 0px;right: 0px;"id="toolbar">-->
<!--<button class="layui-btn" lay-submit id="">预览</button>-->
<!--<button class="layui-btn layui-btn-danger" id="close">关闭</button>-->
<!--</div>-->

<script>
    layui.use(['layer', 'form', 'element','setter','table'], function() {
        var layer = layui.layer
            , form = layui.form
            ,table = layui.table
            , element = layui.element
            ,setter=layui.setter;
        var modelId = "${modelId}";
        $('#close').click(function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        })
        if ($("input[name='ccMessageType']").val()!=""){
            var innerObj = JSON.parse($("input[name='ccMessageType']").val());
            if (innerObj.inner!=1){
                $("input[name=inner]").attr("checked",false);
            }
        }
        form.render(); //更新全部
        //表格初始化
        table.render({
                 elem: '#otherParamCopierTable'
                 // ,height: 312
                 ,url: serverPath.workflowPath + "/workflow/actDefModel/copierList?procDefId=${procDefId}&parentProcDefId=${parentProcDefId}"
                 // ,toolbar:'#toolbar'
                 ,id: 'idTest'
                 ,cols: [[ //表头
                     {
                         type: 'checkbox'
                     },{
                         field: 'index',
                         title: '序号',
                         align: 'center',
                         templet:function (d) {
                             return d.LAY_INDEX;
                         }
                     },{
                         field: 'id',
                         hide: true,
                         title: '规则Id'
                     },{
                         field: 'condition',
                         align: 'center',
                         title: '规则描述',
                         templet:function (d) {
                            var condition = d.condition;
                            if(condition=="[]" || !condition){
                                return '';
                            }else{
                                //转换为JSON
                                var conditionArr = JSON.parse(condition);
                                //转换为数组
                                var conditionJsonShow ="";
                                for(var i=0;i<conditionArr.length;i++) {
                                    var _json = conditionArr[i];
                                    if(i!=0) {
                                        if (_json.compType == "and") {
                                            conditionJsonShow += " 并且 "
                                        } else if (_json.compType == "or") {
                                            conditionJsonShow += " 或者 "
                                        }
                                    }
                                    conditionJsonShow += _json.conDesc;
                                }
                                //添加规则设置的内容
                                return conditionJsonShow ;
                            }
                        }
                     },{
                         field: 'conditionShow',
                         align: 'center',
                         title: '用户描述'
                     },{
                         field: 'groupNo',
                         title: '批次号',
                         align: 'center',
                         edit:'text'
                     }
                 ]]
             });

        //checkBox监听事件
        table.on('checkbox(otherParamCopierTable)', function(obj){
            if(obj.checked){
                $("input[name='conditionId']").val(obj.data.id);
            }else{ return ;}
        });


    })
</script>
